<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>pyopenspime.util</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/pyopenspime/">PyOpenSpime v0.1</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;pyopenspime ::
        Module&nbsp;util
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="pyopenspime.util-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module util</h1><p class="nomargin-top"><span class="codelink"><a href="pyopenspime.util-pysrc.html">source&nbsp;code</a></span></p>
<p>PyOpenSpime generic utility functions.</p>

<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">unicode</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="pyopenspime.util-module.html#convert_client_type_to_name" class="summary-sig-name">convert_client_type_to_name</a>(<span class="summary-sig-arg">typ</span>)</span><br />
      Convert an OSclient type to a literal name.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="pyopenspime.util-pysrc.html#convert_client_type_to_name">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">utf-8 str</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="pyopenspime.util-module.html#to_utf8" class="summary-sig-name">to_utf8</a>(<span class="summary-sig-arg">s</span>)</span><br />
      Convert a string to utf8.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="pyopenspime.util-pysrc.html#to_utf8">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">unicode</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="pyopenspime.util-module.html#generate_rnd_str" class="summary-sig-name">generate_rnd_str</a>(<span class="summary-sig-arg">str_len</span>)</span><br />
      Generates a random string.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="pyopenspime.util-pysrc.html#generate_rnd_str">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">pyopenspime.xmpp.simplexml.Node</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="pyopenspime.util-module.html#parse_all_children" class="summary-sig-name">parse_all_children</a>(<span class="summary-sig-arg">node</span>,
        <span class="summary-sig-arg">node_name</span>,
        <span class="summary-sig-arg">deep_first</span>=<span class="summary-sig-default">False</span>)</span><br />
      Recursively parses all children nodes of a node to find the first 
      node that matches a name.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="pyopenspime.util-pysrc.html#parse_all_children">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">xmpp.simplexml.Node</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="pyopenspime.util-module.html#clean_node" class="summary-sig-name">clean_node</a>(<span class="summary-sig-arg">node</span>)</span><br />
      Recursively deletes all content of a node.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="pyopenspime.util-pysrc.html#clean_node">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">unicode</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="pyopenspime.util-module.html#convert_to_canonical_xml" class="summary-sig-name">convert_to_canonical_xml</a>(<span class="summary-sig-arg">xml</span>)</span><br />
      Converts and XML string to the Canonical XML format as per W3C 
      Canonical XML Version 1.0 &lt;http://www.w3.org/TR/xml-c14n&gt; 
      specifications.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="pyopenspime.util-pysrc.html#convert_to_canonical_xml">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="convert_client_type_to_name"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">convert_client_type_to_name</span>(<span class="sig-arg">typ</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="pyopenspime.util-pysrc.html#convert_client_type_to_name">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Convert an OSclient type to a literal name.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>typ</code></strong> (int) - The OSclient type.</li>
    </ul></dd>
    <dt>Returns: unicode</dt>
        <dd>The literal name of the OSclient type (Spime, ScopeNode, 
          Service).</dd>
  </dl>
</td></tr></table>
</div>
<a name="to_utf8"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">to_utf8</span>(<span class="sig-arg">s</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="pyopenspime.util-pysrc.html#to_utf8">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Convert a string to utf8.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>s</code></strong> (str) - The string to be converted.</li>
    </ul></dd>
    <dt>Returns: utf-8 str</dt>
        <dd>The utf-8 converted string.</dd>
  </dl>
</td></tr></table>
</div>
<a name="generate_rnd_str"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">generate_rnd_str</span>(<span class="sig-arg">str_len</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="pyopenspime.util-pysrc.html#generate_rnd_str">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Generates a random string.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>str_len</code></strong> (int) - The lenght of the string.</li>
    </ul></dd>
    <dt>Returns: unicode</dt>
        <dd>The newly generated string.</dd>
  </dl>
</td></tr></table>
</div>
<a name="parse_all_children"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">parse_all_children</span>(<span class="sig-arg">node</span>,
        <span class="sig-arg">node_name</span>,
        <span class="sig-arg">deep_first</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="pyopenspime.util-pysrc.html#parse_all_children">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Recursively parses all children nodes of a node to find the first node
  that matches a name.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>node</code></strong> (xmpp.simplexml.Node) - The node to parse.</li>
        <li><strong class="pname"><code>node_name</code></strong> (unicode) - The node to find that matches this name.</li>
        <li><strong class="pname"><code>deep_first</code></strong> (boolean) - If set to True, searches into deep before passing to next child. 
          If set to False, searches first children first before going deep.
          Defaults to <i>False</i>.</li>
    </ul></dd>
    <dt>Returns: pyopenspime.xmpp.simplexml.Node</dt>
        <dd>The found node, or None if none found.</dd>
  </dl>
</td></tr></table>
</div>
<a name="clean_node"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">clean_node</span>(<span class="sig-arg">node</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="pyopenspime.util-pysrc.html#clean_node">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Recursively deletes all content of a node.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>node</code></strong> (xmpp.simplexml.Node) - The node to clean.</li>
    </ul></dd>
    <dt>Returns: xmpp.simplexml.Node</dt>
        <dd>The cleaned node.</dd>
  </dl>
</td></tr></table>
</div>
<a name="convert_to_canonical_xml"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">convert_to_canonical_xml</span>(<span class="sig-arg">xml</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="pyopenspime.util-pysrc.html#convert_to_canonical_xml">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Converts and XML string to the Canonical XML format as per W3C 
  Canonical XML Version 1.0 &lt;http://www.w3.org/TR/xml-c14n&gt; 
  specifications.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>xml</code></strong> (unicode or str) - The XML to be converted.</li>
    </ul></dd>
    <dt>Returns: unicode</dt>
        <dd>The canonical XML.</dd>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/pyopenspime/">PyOpenSpime v0.1</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Mon Jun 09 18:55:16 2008
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
